package ua.org.extjsbuilder.parser.runtime.instructions;

import java.io.IOException;
import java.io.Writer;
import java.util.List;

import ua.org.extjsbuilder.parser.IInstruction;
import ua.org.extjsbuilder.parser.IScope;
import ua.org.extjsbuilder.parser.JSObject;

public class Cycle implements IInstruction {
	public static final String WHILE = "while";
	public static final String FOR = "for";
	public static final String DO = "do";
	
	private String type;
	private IInstruction condition;
	private List<IInstruction> mainBlock;
	private IInstruction declaration;
	private IInstruction increment;

	public Cycle(String type, IInstruction condition,
			List<IInstruction> mainBlock) {
		this(type,null,condition,null,mainBlock);
	}

	public Cycle(String type, IInstruction declaration, IInstruction condition,
			IInstruction increment, List<IInstruction> mainBlock) {
		this.type = type;
		this.declaration = declaration;
		this.condition = condition;
		this.increment = increment;
		this.mainBlock = mainBlock;
	}

	public void compile(Writer out, boolean optimize) throws IOException {
		// TODO Auto-generated method stub
		
	}

	public JSObject execute(IScope scope, JSObject[] args) {
		// TODO Auto-generated method stub
		return null;
	}

	public String getName() {
		return type;
	}

	public IInstruction getCondition() {
		return condition;
	}

	public List<IInstruction> getMainBlock() {
		return mainBlock;
	}

	public IInstruction getDeclaration() {
		return declaration;
	}

	public IInstruction getIncrement() {
		return increment;
	}
}
